//
//  LYPersonCheckMeController.m
//  SelectCity
//
//  Created by liuyan on 2019/3/20.
//  Copyright © 2019年 liuyan. All rights reserved.
//

#import "LYPersonCheckMeController.h"
#import "LYPersonCheckMeModel.h"
#import "LYPersonCheckMeCell.h"

@interface LYPersonCheckMeController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableview;
@property (nonatomic, strong) NSMutableArray *dataArray;

@end

@implementation LYPersonCheckMeController

-(NSMutableArray *)dataArray{
    if (!_dataArray) {
        _dataArray = [NSMutableArray array];
        NSArray *array = @[
                           @{@"id": @201922,
                             @"company_id": @1082,
                             @"company_name": @"潮流网络",
                             @"add_time": @1553081265,
                             @"hr_info": @{
                                     @"userid": @884002,
                                     @"name": @"赵先生",
                                     @"avatar": @"",
                                     @"position": @"人事主管"
                                     }},
                           @{@"id": @201922,
                             @"company_id": @1082,
                             @"company_name": @"潮流网络",
                             @"add_time": @1550648038,
                             @"hr_info": @{
                                     @"userid": @884002,
                                     @"name": @"赵先生",
                                     @"avatar": @"",
                                     @"position": @"人事主管"
                                     }}
                           ];
        for (NSDictionary *dic in array) {
            LYPersonCheckMeModel *model = [LYPersonCheckMeModel mj_objectWithKeyValues:dic];
            [_dataArray addObject:model];
        }
    }
    return _dataArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"谁看了我";
    
    [self createSubview];
}

- (void)createSubview{
    self.tableview = [UIToolsControl initTableViewWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT-HeightOfStatusBarAndNavigationBar-SIMEmojKeyBoardkBottomNOSafeArea_Height) target:self style:UITableViewStyleGrouped];
    self.tableview.separatorInset = UIEdgeInsetsZero;
    self.tableview.backgroundColor = COLOR_OF_WHITE;
    
    [self.tableview registerClass:[LYPersonCheckMeCell class] forCellReuseIdentifier:kCellIdentifier_LYPersonCheckMeCell];
    [self.view addSubview:self.tableview];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    LYPersonCheckMeCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_LYPersonCheckMeCell forIndexPath:indexPath];
    cell.model = self.dataArray[indexPath.row];
    return cell;
}

#pragma mark -- UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 80;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 0.001f;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.001f;
}



@end
